<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script language="JavaScript" type="text/javascript">
			function account() {
				var a = prompt("请输入第一个数", "");
				var b = prompt("请输入第二个数", "");
				var c = prompt("请输入选择的运算符号", "");
				var a1 = parseFloat(a);
				var b1 = parseFloat(b); //转换成数
				var sum = 0;
				switch(c) {
					case '+':
						var sum = a1 + b1;
						break;
					case '-':
						var sum = a1 - b1;
						break;
					case '*':
						var sum = a1 * b1;
						break;
					case '/':
						var sum = a1 / b1;
						break;
					default:
						alert("输入错误");
						break;
				}
				alert("运算结果为：" + a1 + c + b1 +"="+sum);
			}
		</script>
	</head>
	<body>
		<input name="btn" type="button" value="计算两数运算结果" onclick="account();" />
	</body>

</html>